﻿@model JuCheap.Models.UserAddDto

@{
    ViewBag.Title = "添加用户";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}

<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>添加用户</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            @using (Html.BeginForm("Add", "User", FormMethod.Post, new {@class = "form-horizontal"}))
            {
                @Html.AntiForgeryToken()
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.LoginName)：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.LoginName, new {@class = "form-control", placeholder = "登录账号名"})
                        @Html.ValidationMessageFor(m => m.LoginName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.RealName)：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.RealName, new {@class = "form-control", placeholder = "真实姓名"})
                        @Html.ValidationMessageFor(m => m.RealName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.Email)：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.Email, new {@class = "form-control", placeholder = "邮箱"})
                        @Html.ValidationMessageFor(m => m.Email)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.Password)：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.Password, new {@class = "form-control", placeholder = "登录密码"})
                        @Html.ValidationMessageFor(m => m.Password)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.ConfirmPwd)：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.ConfirmPwd, new {@class = "form-control", placeholder = "请再次输入登录密码"})
                        @Html.ValidationMessageFor(m => m.ConfirmPwd)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@Html.LabelFor(m => m.DepartmentId)：</label>
                    <div class="col-sm-8">
                        <select id="DepartmentId" name="DepartmentId" class="form-control"></select>
                        @Html.ValidationMessageFor(m => m.DepartmentId)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btn btn-info" type="submit" id="btnSave">保存</button>
                        <button class="btn btn-white" type="button" id="btnBack" data-type="url">返回</button>
                    </div>
                </div>
            }
        </div>
    </div>
</div>

@section styles
{
    <link href="~/Content/js/select2/css/select2.min.css" rel="stylesheet" />
}
@section scripts{
    @Scripts.Render("~/content/js/user", "~/content/js/jqueryValidate", "~/content/js/action")
    <script src="~/Content/js/select2/js/select2.min.js"></script>
    <script>
        $(function() {
            $('#DepartmentId').select2({
                placeholder: "所属部门",
                ajax: {
                    url: '@Url.Action("GetDepartments", "Department")',
                    dataType: 'json'
                }
            });
        });
    </script>
}
